const { Pool } = require('pg');

// 数据库连接配置
const pool = new Pool({
  host: 'localhost',
  port: 5432,
  database: 'dw_sql_manager',
  user: 'postgres',
  password: '1234Qwer'
});

async function checkFoldersTable() {
  try {
    console.log('检查folders表结构...');
    
    // 查询表结构
    const result = await pool.query(`
      SELECT column_name, data_type, is_nullable, column_default
      FROM information_schema.columns 
      WHERE table_name = 'folders' 
      ORDER BY ordinal_position;
    `);
    
    console.log('folders表字段:');
    result.rows.forEach(row => {
      console.log(`- ${row.column_name}: ${row.data_type} (nullable: ${row.is_nullable})`);
    });
    
    // 检查是否存在path字段
    const hasPath = result.rows.some(row => row.column_name === 'path');
    console.log(`\npath字段存在: ${hasPath}`);
    
  } catch (error) {
    console.error('检查数据库结构失败:', error.message);
  } finally {
    await pool.end();
  }
}

checkFoldersTable();